package Sock;


import java.io.*;
import java.net.InetAddress;
import java.net.Socket;


public class time {
    public static void main(String[] args) throws IOException {
        Socket socket=new Socket(InetAddress.getLocalHost(),8888);
        OutputStream buf=socket.getOutputStream();
        buf.write("time命令".getBytes());
        socket.shutdownOutput();


        InputStream buf1= socket.getInputStream();
        int n=0;
        byte[] bytes=new byte[1024];
        while ((n= buf1.read(bytes))!=-1){
            System.out.println("收到"+new String(bytes,0,n));
        }

        buf.close();
        buf1.close();
        socket.close();

    }
}
